package thread;

public class Test13_join {
    public static void main(String[] args) throws InterruptedException {
        LifeCircle lifeCircle = new LifeCircle();
        System.out.println(lifeCircle.isAlive());
        lifeCircle.start();
        System.out.println(lifeCircle.isAlive());
        lifeCircle.join();//先让lifeCircle运行完，再执行main
        System.out.println("主程序的其他操作。。。");
        System.out.println(lifeCircle.isAlive());
    }
}

class LifeCircle extends Thread{
    @Override
    public void run() {
        int i=0;
        while ((++i)<10){
            System.out.println(Thread.currentThread().getName()+":"+i);
            try {
                Thread.sleep(100);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }
    }
}
